Add benchmark to compare rendering times for View and ViewNativeComponent#53248
Closed
rubennorte wants to merge 3 commits into
Closed
Add benchmark to compare rendering times for View and ViewNativeComponent#53248rubennorte wants to merge 3 commits into
rubennorte wants to merge 3 commits into
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
7eb4e53 to
0cb5b0e
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
0cb5b0e to
12e368d
Compare
Differential Revision: D80169516
Differential Revision: D80169515
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
12e368d to
d635431
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
d635431 to
1361074
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
1361074 to
9b3a390
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
9b3a390 to
dc0d348
Compare
…nent (facebook#53248) Summary: Pull Request resolved: facebook#53248 Changelog: [internal] This adds a new benchmark that compares the rendering time (only rendering, not committing, mounting, effects, etc.) of `<View>` and `<ViewNativeComponent>`. Baseline: | (index) | Task name | Latency avg (ns) | Latency med (ns) | Throughput avg (ops/s) | Throughput med (ops/s) | Samples | | ------- | ---------------------------------------- | ----------------- | ------------------ | ---------------------- | ---------------------- | ------- | | 0 | 'render 100 views (Noop)' | '333036 ± 0.39%' | '328452 ± 2393.0' | '3019 ± 0.18%' | '3045 ± 22' | 3003 | | 1 | 'render 100 views (ViewNativeComponent)' | '1335974 ± 3.45%' | '1228468 ± 7541.5' | '797 ± 0.71%' | '814 ± 5' | 1000 | | 2 | 'render 100 views (View)' | '2296988 ± 1.60%' | '2170821 ± 12374' | '449 ± 0.74%' | '461 ± 3' | 1000 | This shows that **`<View>` currently has an overhead of 75% in rendering time**. I've also tested a modification of `View` such as: ``` component View(...props: ViewProps) { return { // This tag allows us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, // Built-in properties that belong on the element type: ViewNativeComponent, key: undefined, // $FlowExpectedError[prop-missing] ref: props.ref, props, }; } ``` This makes `View` basically a no-op component, and the benchmark after this looks like: | (index) | Task name | Latency avg (ns) | Latency med (ns) | Throughput avg (ops/s) | Throughput med (ops/s) | Samples | | ------- | ---------------------------------------- | ----------------- | ----------------- | ---------------------- | ---------------------- | ------- | | 0 | 'render 100 views (View)' | '1743010 ± 2.25%' | '1630816 ± 10616' | '600 ± 0.74%' | '613 ± 4' | 1000 | | 1 | 'render 100 views (ViewNativeComponent)' | '1370699 ± 4.04%' | '1242284 ± 14172' | '789 ± 0.74%' | '805 ± 9' | 1000 | This shows that `View`, just for existing as a wrapper component, has an overhead of 31% in rendering time, which means that **the opportunities to reduce the overhead beyond what we already did are limited**. Reviewed By: rshest Differential Revision: D80169514
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80169514 |
dc0d348 to
8a0f8b7
Compare
Contributor
|
This pull request has been merged in d009a02. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Changelog: [internal]
This adds a new benchmark that compares the rendering time (only rendering, not committing, mounting, effects, etc.) of
<View>and<ViewNativeComponent>.Baseline:
This shows that
<View>currently has an overhead of 75% in rendering time.I've also tested a modification of
Viewsuch as:This makes
Viewbasically a no-op component, and the benchmark after this looks like:This shows that
View, just for existing as a wrapper component, has an overhead of 31% in rendering time, which means that the opportunities to reduce the overhead beyond what we already did are limited.Differential Revision: D80169514